var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        im.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        im.dispose()
    } else {
        if (status === a++) {
            if (im.haveItem(2431748, 100)) {
                im.gainItem(2431748, -100);
                im.gainItem(4030021, 1)
            } else {
                im.sendOkS("收集到#b100个#i2431748##z2431748##k的话，就可以合成#r#i4030021##z4030021##k了。")
            }
            im.dispose()
        }
    }
};